PATHMac OS 8 Developer Documentation > Operating System Services > Multiprocessing Services >

Adding Multitasking Capability to Applications Using Multiprocessing Services

   

MPWaitOnQueue

Obtains a message from a specified message queue.

OSStatus MPWaitOnQueue (
                     MPQueueID queue,
                     void **param1,
                     void **param2,
                     void **param3,
                     Duration timeout);
queue
A value of type MPQueueID that specifies the ID of the message queue from which to receive the notification.
param1
A pointer to a 32-bit variable. On return, this variable contains the first 32-bits of the notification message. Pass NULL if you do not need this portion of the message.
param2
A pointer to a 32-bit variable. On return, the variable contains the second 32-bits of the notification message. Pass NULL if you do not need this portion of the message.
param3
A pointer to a 32-bit variable. On return, the variable contains the third 32-bits of the notification message. Pass NULL if you do not need this portion of the message.
timeout
A value of type Duration specifying how long to wait for a notification before timing out. See Timer Duration Constants for a list of constants you can use to specify the wait interval.
function result
A result code. See Result Codes for a list of possible values.
DISCUSSION

This function receives a message from the specified message queue. If no messages are currently available, the timeout specifies how long the function should wait for one. Tasks waiting on the queue are handled in a first in, first out manner; that is, the first task to wait on the queue receives the message from the MPNotifyQueue call.

After calling this function, when a message appears, it is removed from the queue and the three fields, param1 , param2 , and param3 are set to the values specified by the message text. Note these parameters are pointers to variables to be set with the message text.

If you call this function from a cooperative task, you should specify only kDurationImmediate for the timeout length; other waits will cause the task to block.

VERSION NOTES

Introduced with Multiprocessing Services 1.0.

SEE ALSO

The function MPNotifyQueue .


© 1999 Apple Computer, Inc. – (Last Updated 07 May 99)